import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class DialogUtils {
  static Future<bool?> showConfirmDialog(BuildContext context, String title, String content){
    return showDialog<bool>(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text(title),
          content: Text(content),
          actions: <Widget>[
            TextButton(
              child: Text("取消"),
              onPressed: () {
                Navigator.of(context).pop(false); // 关闭对话框并返回false
              },
            ),
            TextButton(
              child: Text("确认"),
              onPressed: () {
                // onConfirm(); // 执行确认操作
                Navigator.of(context).pop(true); // 关闭对话框并返回true
              },
            ),
          ],
        );
      },
    );
  }
}